package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.service.IFollowService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 虎哥
 * @since 2021-12-22
 */
@RestController
@RequestMapping("/follow")
public class FollowController {
       @Resource
       private IFollowService followService;

    /**
     * 实现关注或者取关
     * @param followUserId
     * @param isFlow
     * @return
     */
       @PutMapping("/{id}/{isFlow}")
      public Result follow(@PathVariable("id") Long followUserId, @PathVariable("isFlow") Boolean isFlow){
         return followService.follow(followUserId,isFlow);
   }

    /**
     * 判断是否关注
     * @param followUserId
     * @return
     */
      @GetMapping("/or/not/{id}")
     public Result isFollow(@PathVariable("id") Long followUserId){
          return followService.isFollow(followUserId);
      }

    /**
     * 共同关注
     * @return
     */
      @GetMapping("/common/{id}")
    public Result followCommons(@PathVariable("id") Long id){
          return followService.followCommons(id);
      }

}
